Skip to content

feat(snippets): add commands for snippet feature#255

Merged
Akinator31 merged 9 commits intomainfrom
212-snippets
Nov 26, 2025
Merged

feat(snippets): add commands for snippet feature#255
Akinator31 merged 9 commits intomainfrom
212-snippets

Conversation

@Akinator31
Copy link
Copy Markdown
Member

This pull request adds support for managing and using text snippets in the bot, including database migration, command registration, and integration with existing reply and anonreply commands. Users can now store reusable snippets and reference them in replies using a special syntax or command options.

Database and Migration:

  • Added a new snippets table to the database with fields for key, content, creator, and timestamps, along with an index for efficient lookup.
  • Introduced SQL query definitions for creating, retrieving, updating, and deleting snippets.

Command Registration and Structure:

  • Registered the new SnippetCommand and included module imports for snippet-related commands in the bot command registry.
  • Added module structure for snippet commands, supporting both slash and text command styles.

Reply and Anonreply Command Integration:

  • Updated both reply and anonreply text commands to support referencing a snippet by using {{snippet_key}} syntax; the content is replaced with the snippet if found, otherwise an error is returned.
  • Enhanced the reply slash command to accept an optional snippet argument, fetch its content from the database, and use it in the reply.

@Akinator31 Akinator31 self-assigned this Nov 26, 2025
@Akinator31 Akinator31 linked an issue Nov 26, 2025 that may be closed by this pull request
@Akinator31 Akinator31 merged commit d3e1afd into main Nov 26, 2025
6 checks passed
@Akinator31 Akinator31 deleted the 212-snippets branch November 26, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snippets

1 participant